Skip to content

fix(device): select the only booted iPhone or iPad before ranking iPhones above iPads - #5076

Merged
thymikee merged 1 commit into
callstack:mainfrom
sjkim-expo:sjkim/prefer-only-booted-simulator
Nov 24, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
sjkim-expo:sjkim/prefer-only-booted-simulator

Conversation

@sjkim-expo

@sjkim-expo sjkim-expo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With one booted iPad simulator and three shut-down iPhones, iOS commands without a selector fail with AMBIGUOUS_MATCH. Apple ranking drops the iPad before boot state is considered.

This change puts iPhones and iPads of the same kind (simulator or hardware) in one tier. The only booted handheld in the best tier wins; otherwise, the existing iPhone-over-iPad ranking applies.

Simulators still rank above hardware, and handhelds above TV, desktop, and watch. A booted iPhone plus a booted iPad still selects the iPhone. Equal matches still require an explicit selector. The ranking documentation is updated.

Before / after

For resolveDevice(devices, { platform: 'ios' }), with one booted iPad simulator and three shut-down iPhone simulators:

  • Base 8a29aea9a: throws AMBIGUOUS_MATCH: “3 devices match this request equally; select one explicitly.”
  • Head f8ccebdb2: returns the booted iPad.

A live Mac check with one booted iPad (A16, iOS 26.5) and 10 shut-down iPhones confirmed the same behavior. Running node bin/agent-device.mjs capabilities --platform ios --json without a selector selects the booted iPad at head (exit 0). Base throws AMBIGUOUS_MATCH: “10 devices match this request equally; select one explicitly.” (exit 1).

Validation

Tested head f8ccebdb2 against base 8a29aea9a.

  • All 43 kernel device tests passed.
  • check:affected --run passed format, lint, typecheck, layering, fallow, build, and vitest-related checks (441 tests). It stopped at the unit lane on the Revyl failure described below, so daemon-wire-compat did not run within the gate.
  • Run separately at head, check:daemon-wire-compat passed with the protocol unchanged, test:smoke passed all 76 tests, and check:tmpdir-leaks was clean.
  • The full unit suite finished with 21,937 passed, 1 failed, and 10 skipped.

The only unit failure was packages/provider-revyl/src/runtime.test.ts: “Revyl answers health with 503 until the worker attaches, and the start keeps polling,” which timed out after 5,000 ms. It fails the same way on base and is unrelated to this change. The gate and full unit suite therefore remain failing; how to handle that pre-existing failure for merge readiness is up to maintainers.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

…ones above iPads

An iPad session with several shut-down iPhone simulators failed every
command without a selector: the iPhone rank dropped the booted iPad before
the booted check, so the shut-down iPhones tied and selection refused with
AMBIGUOUS_MATCH. iPhones and iPads of one kind now share a tier, and its
only booted member wins. With none or several booted, an iPhone still
ranks above an iPad. Simulators over hardware and handhelds over TV,
desktop, and watch are unchanged.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. Reviewed at f8ccebd: the change selects the only booted iPhone or iPad before ranking iPhones above iPads, and the code trace shows no problem. CI is green on this commit, with 2 checks and none failing. The local provider-revyl runtime.test.ts failure (a 503 health timeout) is outside the diff, which touches only the kernel device.ts and device.test.ts. No conflicts. Not verified here: the kernel tests and the live Mac CLI check were not run, and both are taken from the PR body and the code trace. Nothing else needs to change before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee
thymikee merged commit 758ae64 into callstack:main Nov 24, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants